From f9c5a6235f538ea0b0aebd12ab851c88f986cd38 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Wed, 17 Aug 2005 10:18:34 +0000 Subject: [PATCH] Recreate watches on domain restore. Signed-off-by: Christian Limpach --- .../drivers/xen/xenbus/xenbus_probe.c | 1 + linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 12 ++++++++++++ linux-2.6-xen-sparse/include/asm-xen/xenbus.h | 1 + 3 files changed, 14 insertions(+) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index e5c625d752..63923361a1 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -309,6 +309,7 @@ void xenbus_suspend(void) void xenbus_resume(void) { xb_init_comms(); + reregister_xenbus_watches(); up(&xenbus_lock); } diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index 211677b35d..2e9c79361d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -496,6 +496,18 @@ void unregister_xenbus_watch(struct xenbus_watch *watch) watch->node, err); } +/* Re-register callbacks to all watches. */ +void reregister_xenbus_watches(void) +{ + struct xenbus_watch *watch; + char token[sizeof(watch) * 2 + 1]; + + list_for_each_entry(watch, &watches, list) { + sprintf(token, "%lX", (long)watch); + xs_watch(watch->node, token); + } +} + static int watch_thread(void *unused) { for (;;) { diff --git a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h index 8e9593ff90..8ffbcb75ef 100644 --- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h +++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h @@ -121,6 +121,7 @@ void unregister_xenstore_notifier(struct notifier_block *nb); int register_xenbus_watch(struct xenbus_watch *watch); void unregister_xenbus_watch(struct xenbus_watch *watch); +void reregister_xenbus_watches(void); /* Called from xen core code. */ void xenbus_suspend(void); -- 2.30.2